Method and Apparatus for Enhancing Images

ABSTRACT

A method and an apparatus for enhancing images are provided. An input image generated by an imaging device, such as a short-wavelength infrared (SWIR) camera, sensor, or any other imaging device, is processed to produce an input histogram representing the distribution of pixel intensities in the input image. Histogram start and end points are determined, and a variable plateau profile is calculated depending upon the type of enhancement desired. The plateau profile could take on any desired shape or size, and two or more plateau regions could be included in the profile. The input histogram is clipped along the variable plateau profile. A cumulative histogram is constructed from the clipped histogram, and is normalized. The input image is then transformed into an enhanced output image using the normalized cumulative histogram as a look-up table.

RELATED APPLICATIONS

This application is a continuation application of and claims the benefit of priority to U.S. patent application Ser. No. 11/762,184 filed Jun. 13, 2007, now U.S. Pat. No. 8,218,868, the entire disclosure of which is expressly incorporated herein by reference.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates to image enhancement, and more specifically, to a method and apparatus for enhancing images using variable plateau histogram equalization.

2. Related Art

In various imaging applications, such as military imaging applications, it is often desirable to enhance an image acquired by a camera or sensor to reveal additional detail in the image. For example, where images are taken in the presence of a bright light, details in shadows and in bright areas are often lost. Likewise, details are often lost in dark areas of dark images. As such, it is desirable to reveal such details without compromising overall image quality.

A number of image enhancement methods have, in the past, been developed. Examples of such methods include contrast stretching, histogram equalization, histogram projection, and plateau equalization. In contrast stretching, pixel intensity distributions are expanded (“stretched”) to occupy a full range of possible values. According to this method, minimum and maximum pixel intensity values are measured (or estimated), and offset and gain correction values are applied to the pixel intensity values corresponding to each pixel in the image, so that the full range of intensity values is occupied. In histogram equalization, the pixel intensity distribution is attenuated or flattened. According to this method, an input histogram is constructed, which includes the total number of pixels corresponding to each intensity level within the image. Then, a cumulative histogram is constructed and normalized, and each pixel in the image is transformed using the normalized cumulative histogram as a look-up table. In histogram projection, a histogram is constructed, consisting of occupied and unoccupied levels. A cumulative histogram is then constructed and normalized, and each pixel in the image is transformed using the normalized cumulative histogram as a look-up table. In plateau equalization, an input histogram is constructed and clipped at a specified level or “plateau.” Then, a cumulative histogram is constructed and normalized, and each pixel in the image is transformed using the normalized cumulative histogram as a look-up table.

The foregoing image enhancement methods suffer from a number of drawbacks. For example, existing image enhancement methods do not adequately reveal detail in specific regions of an image, such as shadows or bright areas. Rather, these methods uniformly enhance an entire image, which may result in distortion of other regions of the image for the sake of enhancing a desired region of the image. Further, existing image enhancement methods cannot be easily adapted, without manual adjustment, to enhance images in different environments (e.g., by dynamically altering enhancement characteristics in response to changes in camera sensitivity).

Accordingly, what would be desirable, but has not yet been provided, is a method and apparatus for enhancing images which addresses the foregoing limitations of existing image enhancement methods.

SUMMARY OF THE INVENTION

The present invention relates to a method and apparatus for providing image enhancement, which can be utilized with any suitable imaging device (e.g., short wavelength infrared (SWIR) camera, sensor, imager, or any other device) to enhance images produced by the device. An input histogram corresponding to an image to be enhanced is constructed. The input histogram represents a pixel intensity distribution corresponding to the image. A variable plateau is established, and the input histogram is clipped at the plateau. The variable plateau could be formed in any desired size or shape, and can be varied to adapt to changing scene conditions, light levels, camera conditions, or in response to other conditions. Multiple plateaus can be established for enhancing desired regions of the image, such as dark regions (shadows) and bright areas of the image. A cumulative histogram is constructed from the clipped histogram, and is normalized to produce a normalized cumulative histogram. The normalized cumulative histogram is used as a look-up table to transform pixels of the input image to produce an enhanced output image. Automatic gain control (AGC) functions can be applied to provide additional enhancement of the image.

BRIEF DESCRIPTION OF THE DRAWINGS

These and other important objects and features of the invention will be apparent from the following Detailed Description of the Invention, taken in connection with the accompanying drawings, in which:

FIG. 1 is a flowchart showing a method according to the present invention for enhancing an image;

FIG. 2 is a flowchart showing enhanced automatic gain control features of the present invention for providing additional image enhancement;

FIG. 3 is a flowchart showing, in greater detail, optional non-linear operations according to the present invention for providing additional image enhancement;

FIG. 4 is a flowchart showing, in greater detail, an optional process according to the present invention for interpolating pixel values;

FIGS. 5 a-5 g depict sample histograms illustrating variable histogram plateaus implemented by the present invention;

FIGS. 6 a-6 b are photographs illustrating results of the image enhancement method of the present invention, wherein shadow details are enhanced in a lighted scene;

FIGS. 7 a-7 b are photographs illustrating results of the image enhancement method of the present invention, wherein shadow details are enhanced in a scene having a normal light level;

FIGS. 8 a-8 b are photographs illustrating results of the image enhancement method of the present invention, wherein enhancement of bright regions of an image is provided; and

FIG. 9 is a block diagram of a short wavelength infrared (SWIR) camera including the image enhancement functionality of the present invention.

DETAILED DESCRIPTION OF THE INVENTION

The present invention relates to a method and apparatus for enhancing images. Desired aspects of an image, such as shadow regions or bright areas of the image, can be enhanced by the present invention to provide additional detail. An input image acquired by an imaging device, such as a short-wavelength infrared (SWIR) camera, sensor, or any other imaging device, is processed by the present invention to produce an input histogram representing the distribution of pixel intensities in the input image. Optionally, saturated and/or low pixels in the input image can be excluded. Histogram start and end points are determined, and a variable plateau is calculated depending upon the type of enhancement desired. The plateau may be varied along the histogram and can take on any desired shape, size, or number of plateau regions. When the plateau is calculated, the histogram is clipped therealong. A cumulative histogram is constructed from the clipped histogram, and is normalized. The input image is then transformed into an enhanced output image using the normalized cumulative histogram as a look-up table. Optional non-linear operations can be performed on the normalized cumulative histogram. The enhancement method can be automatically varied to adapt to various imaging device types as well as changes in scene conditions.

FIG. 1 is a flowchart showing a method according to the present invention, indicated generally at 10, for enhancing an image. In step 12, an input histogram is constructed, wherein the bins of the histogram represent the pixel intensity distribution of the image. Optionally, saturated (i.e., pixels having an intensity level above a pre-defined threshold) and/or low pixels (i.e., pixels having an intensity level below a pre-defined threshold) can be excluded from the histogram. It should be noted that a user could specify a minimum number of pixels to be collected before histogram processing.

In process block 14, automatic gain control (AGC) processes are initiated for controlling the gain of the output image. In step 16 a, the average pixel value of an image frame is calculated. Then, in step 16 b, if the calculated average pixel value is at or near a pre-defined minimum or maximum pixel value, AGC processing is disabled. This prevents the present invention from remaining indefinitely in an AGC processing condition which can result if a camera is operating in a darkened room and lights are abruptly turned on and saturated pixels are removed from the image, or if a camera is operating in a bright-lit room and lights are abruptly turned off and low pixels are removed from the image. Parameters other than the average pixel value can be used for this process, including the number of saturated pixels expressed as a percentage of the total pixels collected, or the number of low pixels expressed as a percentage of the total pixels collected.

In step 16 c, the number of saturated pixels in the input image is counted. In step 16 d, the saturated pixels are used for AGC adjustment of an imager or camera, as discussed below with reference to FIG. 2. In step 16 e, the average histogram pixel value is calculated. Then, in step 16 f, the average pixel value is used for AGC adjustment of an imager or camera, as discussed below with reference to FIG. 2. In step 16 g, the number of histogram pixels is counted. This information is later used in step 16 h, wherein AGC adjustments are made based on the start of the histogram, as discussed below with reference to FIG. 2.

In step 18, histogram start and end values are determined, using a portion (fraction) of the number of histogram pixels. The start of the histogram is the first bin to exceed an input minimum or “floor” value and the end of the histogram is the last bin to exceed the input floor value. When the method 10 is first carried out, the input floor level could be set to a pre-defined level, which could be programmed by a user. Other methods to determine the start and end of the histogram are possible. For example, starting at the lowest histogram bin, the start of the histogram could be found when the cumulative pixels are at least a percentage (e.g., 1.5%) of the total number of pixels collected. Moving through the histogram, the end of the histogram could then be found when the cumulative pixels are at least 100% minus a percentage (e.g., 100%−1.5%=98.5%) of the total number of pixels collected. In this example, the histogram, from start to end, would contain approximately 97% of the total number of pixels collected. Such a method has been found to be less sensitive to noise. Another alternative is to use the input floor value, described above, for the number of pixels needed at each end of the histogram instead of using a percentage of the total number collected. Still further, other methods for calculating a floor value could be utilized, such as taking a fraction of the average number of pixels per bin, or a fraction of the average pixel value per bin.

The plateau profile could include two plateaus (illustratively, plateaus “A” and “B”) which correspond, respectively, to a “dark” plateau and a “light” plateau. The “dark” plateau represents a clipping level for enhancing details in shadows or dark regions of the input image. The “light” plateau represents a clipping level for enhancing details in light regions of the input image. In step 20, a plateau boundary is calculated, which represents the bin at which the clipping level transitions from plateau A to plateau B. Of course, the plateaus could take any shape and could be adjusted as desired. Importantly, the plateaus and the transitions between plateaus can be varied to highlight desired regions of the input image, and could also be automatically changed (e.g., by electronic means) to adjust to various operating parameters of different cameras or sensors, as well as to changing light levels or other scene conditions. Additionally, the plateau profile could vary from bin to bin of the histogram.

After the plateau boundary has been calculated in step 20, in step 22, the input histogram is clipped at the plateaus, such that all values above the clipping levels are reduced to the clipping levels. If two plateaus (such as plateaus A and B, discussed above) are defined, the to histogram is clipped at the two plateaus. After clipping, in step 24, a cumulative histogram is constructed from the clipped histogram. Each bin in the cumulative histogram includes the total number of pixels in the current bin plus the number of pixels in the preceding bin. The cumulative histogram is thus the integral of the distribution represented by the clipped input histogram.

In step 26, the cumulative histogram is normalized to the number of output levels in the output image. For example, if 256 possible output values are in the output image, the cumulative histogram would be normalized to the 256 output values from 0 to 255. Optional step 30 could then be carried out, wherein non-linear functions (discussed below with respect to FIG. 3) are applied to the normalized cumulative histogram. In step 28, pixels of the input image are transformed using the normalized cumulative histogram as a lookup table (as is done in conventional histogram equalization and plateau equalization processes), to produce the output image. Optionally, step 32 can be carried out to produce an output image using an interpolation procedure (discussed below with respect to FIG. 4). The output image produced in step 28 is thus enhanced to show additional detail in desired regions of the input image.

FIG. 2 is a flowchart, indicated generally at 36, showing enhanced automatic gain control (AGC) features of the present invention for providing additional image enhancement. As mentioned above, the present invention can be applied to enhance various aspects of an input image, so as to accentuate highlights in the image, details in shadows, or normal enhancement of the input image based on average pixel values. In step 38, a determination is made as to whether the average pixel value of a frame (saturated and low pixels are included) is out of a pre-defined range. In a 12-bit system, a suitable range could include values less than 3 or more than 4000. If a positive determination is made, step 40 is invoked, wherein the gain of the imager is adjusted (e.g., in the same manner used for normal AGC functions). Otherwise, in step 42, a determination is made as to the type of enhancement desired for automatic gain control. If it is determined that highlight enhancement is desired, step 44 is invoked, wherein the gain level of the imager (e.g., SWIR camera, sensor, or any other suitable type of device) is set based on the number of saturated pixels in the input image. If it is determined that normal enhancement is desired, step 48 is invoked, wherein the imager gain level is set based on the average pixel value for all pixels, optionally minus the saturated and/or low-value pixels, in the input image. If it is determined that shadow enhancement is desired, step 46 is invoked, wherein the imager gain level is set based on the start of the input histogram (where low-level pixels are represented in the input histogram) to accentuate detail in shadow regions of the input image. It should be noted that a stepped digital gain can be applied in step 52 so that the imager's dark histogram is expanded to cover additional histogram bins. The result is a higher contrast, more pleasing image. As described below, the digital gain is increased in low-light mode and is independent of the chosen AGC method.

Once the desired enhancement type has been selected and the corresponding gain of the imager adjusted, a determination is made in step 49 as to whether gain adjustment is needed. If not, processing ends. If a positive determination is made, step 50 occurs, wherein a determination is made as to whether additional gain is required, even though the imager may already be adjusted to a maximum gain level. If a positive determination is made, optional step 52 occurs, wherein enhancement parameters are further adjusted for low light level conditions. In step 54, the gain of the imager is adjusted to the gain level set in either of steps 44, 46, or 48, or as modified in optional step 52.

In optional process 56, average AGC parameters for the desired number of frames of the input image can be determined, and adjusted as desired. Such a feature can operate in conjunction with the other processes shown in FIG. 2, so as to provide added enhancement over a specific number of frames of the input image. It should also be noted that the enhanced AGC processing shown in FIG. 2 could be employed independent of the processing shown in FIG. 1 and discussed above, or in conjunction therewith.

The gain adjustment feature of the present invention allows for gain changes in steps of roughly 2.2. Look-up tables can be used for each gain range (operational setting or “OPR”) to set the various electrical parameters of the imager. If the gain is changed while the AGC parameters are averaged over n frames, the output of the averager will not immediately change in response to the step gain change. Thus, it is possible that the present invention will keep changing the gain until the change appears at the output of the averager, causing the AGC to overshoot and hunt or oscillate. In the present embodiment, for example, the camera runs at 60 frames per second (˜0.5 seconds for 32 frames) and the AGC algorithm runs every 0.1 second. One solution for addressing this possibility is to lower the AGC sample rate after a gain change and wait for the change to propagate through the averager before examining its output.

The AGC features of the present invention could be augmented by the inclusion of a “boxcar averager” to average AGC data from 1 to 32 frames, so as to provide for continuous gain adjustments that are immediately available in the output image. The boxcar averager includes a common timing scheme for all data streams. The boxcar averager could be implemented in the following steps: (1) after a gain change, wait a first predetermined period of time for electrical adjustments to settle (for example, 0.1 seconds per AGC period); (2) wait a second predetermined period of time for the camera hardware to acquire at least one new frame at the new gain setting (for example, 1/60 second), and calculate the new AGC parameters; (3) store the new AGC parameters (i.e., “fill” all the boxcars with the new AGC parameters); and (4) resume normal boxcar operation and normal AGC calculations. It has been found that such an implementation results in gain changes that can be quickly implemented in the output image, without oscillation, when operated with 32 frame averaging.

FIG. 3 is a flowchart showing, in greater detail, the optional non-linear operations step 30 of FIG. 1. The optional non-linear operations provide additional enhancement of the input image. In step 62, the normalized cumulative histogram is generated. Then, in step 64, the square root of the data contained in each bin in the normalized cumulative histogram is calculated (r operator) and applied to the normalized cumulative histogram, and the cumulative histogram is re-normalized. In step 66, the resulting normalized cumulative histogram is multiplied by a ramp function of (n+bin/[highest bin])/(n+1), where bin represents the current bin and highest bin represents the highest bin in the histogram. It has been found that the square root operation in step 64 results in increased detail of images in the presence of bright light sources. Of course any other suitable linear or non-linear operations could be employed without departing from the spirit or scope of the present invention. For example, the square root processing function could be generalized from n^(0.5) to n^(p), where p is a value specified by the user. It has been found that some scenes look better with p values other than 0.5. Also, a sin processing function of (n+sin(π/2*bin/[highest bin])/(n+1) could be applied in step 64. It has been found that using a ramp function in step 64 improves operation in the presence of veiling glare, i.e., stray light in optical systems caused by reflections between surfaces of lens elements and inside the barrel of a lens. Moreover, user-defined lookup tables could be applied in place of the square root and sin operations discussed above.

FIG. 4 is a flowchart showing, in greater detail, the optional interpolation step 32 of FIG. 1. The interpolation process can be used to reduce quantization effects (i.e., “contouring” or loss of detail when converting a gradient image into an image with a smaller number of intensities or values) that can result when the normalized cumulative histogram contains fewer bins than the number of pixel levels actually present in the input image. The interpolation process could also be used to reduce contouring resulting from other causes, such as contrast stretching. In step 72, a given pixel value (e.g., the first bin in the normalized cumulative histogram) is divided by a bin divider of 2^(n), where n represents an integer value that produces a desired number of bins. For example, with 12-bit pixels (4096 levels) and n=4 (2^(n)=16), the number of bins is 256 (2¹²/2⁴=2⁸) It has been found that bin dividers of 2^(n) are easily determined using computing hardware but, of course, any other suitable bin divider value could be used. The output of step 72 produces a result and a remainder, which represent a right shift of n places. In step 74, the right shift is used to retrieve a pixel value and a difference in corresponding histogram and difference bins. For example, if the pixel value is 46, the result of 46/16 is 2 and the remainder is 14. The corresponding pixel value for bin 2 of the normalized cumulative histogram (e.g., 200) would be retrieved. The most significant bits (MSBs) of the 12-bit output pixel are: 200*16=3200. Then, in step 76, the pixel value for the next highest bin (i.e., adjacent bin) is retrieved (e.g., bin 3, which could have a value of 232). The difference between the bin value corresponding to the bin (bin 2, with value of 200) and the next highest bin (bin 3, with value of 232) is calculated (232−200=32), and the difference is multiplied by the remainder to calculate the least significant bits (LSBs) of the 12-bit output pixel (32*14=448). The interpolated 12-bit output pixel value would be the sum of these two steps (3200+448=3648). The resulting interpolated bin (pixel) value can be used as an actual pixel value, and can be included in the enhanced output image. Mathematically, the calculation could be expressed as (bin 1+(bin 2−bin 1)*remainder/bin divider)*bin divider=bin 1*bin divider+(bin 2−bin 1)*remainder.

The interpolation process of the present invention could be advantageously implemented using two lookup tables, wherein the first lookup table contains the cumulative histogram data corresponding to the input image, and the second lookup table contains the differences between entries in the first lookup table. The difference calculation can be performed as the tables are created, to prevent the need for calculating in real time. If each pixel of the input image is twelve bits in length, the most significant 8 bits would be used as a lookup key for the lookup tables. A number proportional to the least significant 4 bits is added to the most significant 8 bits, resulting in an interpolated 12 bit pixel. This could be expressed mathematically as follows: interpolated output pixel value=(8-bit cumulative histogram bin value)*bin divider+(least significant 4 bits of input pixel)*difference. It has been found that for a small number of bins, e.g., 64, interpolation has improved the output image in many observed circumstances. For 256 bins, interpolation has also improved the image in a few observed circumstances.

FIGS. 5 a-5 g depict sample histograms illustrating variable histogram plateaus that can be implemented by the present invention. Advantageously, the present invention allows for a multitude of plateaus of various shapes to be defined and utilized to clip an input histogram so as to enhance desired aspects of the input image.

FIG. 5 a depicts a sample histogram wherein the present invention implements a horizontal plateau 84 across the histogram bins. The horizontal plateau 84 allows for conventional plateau equalization known in the art, wherein the bins are clipped at the plateau 84 (i.e., pixel frequencies above the plateau 84 are brought down to the plateau 84, as illustrated by the shaded portions of the bins in FIG. 5 a). Advantageously, the enhanced AGC functionality of the present invention could also be applied once an output image is generated using the clipped histogram, to provide additional enhancement, regardless of the type of histogram plateau implemented by the present invention.

FIG. 5 b shows a sample histogram wherein the present invention implements a sloped or “tapered” plateau 88 across the histogram bins. It has been found that the sloped plateau 88 produces good enhancement of images where lighting changes from scene to scene. As shown in FIG. 5 c, an optional offset 92 could be provided, wherein the sloped plateau 88 begins at the offset 92. Also, an optional input floor 93 could be included, wherein a minimum bin value of a pre-defined threshold is established for all bins. As shown in FIG. 5 d, the plateau 88 could be implemented between a maximum threshold 102 and a midpoint 100 which represents the mean of the offset 92 and the maximum threshold 102. It has been found that an offset, tapered plateau (such as the plateau 88 as shown in FIGS. 5 c and 5 d) results in better image enhancement than a tapered plateau applied to the entire histogram (such as the plateau 88 as shown in FIG. 5 b). Additionally, it has been found that the tapered plateau shown in FIGS. 5 b-5 d result in accentuation of pixels having low brightness levels while attenuating high brightness levels.

As shown in FIG. 5 e, the present invention allows for a multi-level plateau 108 to be established, wherein the multi-level plateau 108 includes a high plateau region 110, a first transition point 112, a tapered or sloped plateau region 114, a second transition point 116, and a low plateau region 118. In such an arrangement, dark regions of the input image are enhanced at the expense of bright regions of the image. As shown in FIG. 5 f, the shape of the multi-level plateau 108 could be altered, such that a multi-level plateau 122 is produced having a low plateau region 124, a first transition point 126, a sloped or tapered region 128, a second transition point 130, and a high plateau region 132. In this arrangement, bright regions of the input image are enhanced at the expense of dark regions of the image. Further, as shown in FIG. 5 g, two plateaus could be produced, including a first or “dark” plateau 134 for enhancing dark regions in the input image, and a second or “light” plateau 136 for enhancing light regions of the input image. The transition between the dark plateau 134 and the light plateau 136 could occur at a midpoint between an offset and a maximum value, such as the midpoint 100 shown in FIG. 5 d. It should be appreciated any plateau of any desired size or shape could be implemented without departing from the spirit or scope of the present invention.

The various plateaus capable of being implemented by the present invention, such as those shown in FIGS. 5 a-5 g, could be automatically calculated and implemented by a suitable image processing system, based upon the type of enhancement desired by the user. For example, if enhancement of dark regions in an image is desired, a plateau similar to the plateau shown in FIG. 5 g could be automatically calculated, and the input histogram for the image clipped at the plateau. Moreover, different plateaus could be automatically implemented based upon changing scene conditions, including, but not limited to, changes in scene light levels.

FIGS. 6 a-6 b are photographs illustrating results of the image enhancement method of the present invention, wherein shadow details are enhanced in a lighted scene. FIG. 6 a shows the original input image, wherein a desk lamp is turned on. For purposes of illustration, a shadow region within the box 140 is shown. FIG. 6 b shows an output image generated by the image enhancement method of the present invention, corresponding to the input image. As can be readily appreciated, a significant amount of additional detail can be seen in the box 140 of the processed image, which detail is otherwise invisible in the original image. The image shown in FIG. 6 b was produced using a plateau having a shape approximating the plateau shown in FIG. 5 g and described herein along with the histogram start AGC method and square root post-processing described above.

FIGS. 7 a-7 b are photographs illustrating results of the image enhancement method of the present invention, wherein shadow details are enhanced in a scene having a normal light level (the desk lamp is off). FIG. 7 a shows the original input image. For purposes of illustration, a shadow region within the box 142 is shown. FIG. 7 b shows an output image generated by the image enhancement method of the present invention, corresponding to the input image. As can be readily appreciated, a significant amount of additional detail can be seen in the box 142 of the processed image, which detail is otherwise invisible in the original image. The image shown in FIG. 7 b was produced using a plateau having a shape approximating the plateau shown in FIG. 5 g and described herein along with the histogram start AGC method and square root post-processing discussed above.

FIGS. 8 a-8 b are photographs illustrating results of the image enhancement method of the present invention, wherein enhancement of bright regions of an image is provided. FIG. 8 a is an image of a parking lot taken on a sunny day, and the image includes very bright regions. FIG. 8 b shows the results of bright enhancement of the present invention applied to the image of FIG. 8 a. As can be readily appreciated, a significant amount of detail not visible in the original image (FIG. 8 a) can clearly be seen in the enhanced image (FIG. 8 b). The image shown in FIG. 8 b was produced using a plateau having a shape approximating the plateau shown in FIG. 5 g and described herein along with the saturated pixel AGC method and square root post-processing described above.

FIG. 9 is a block diagram of a short wavelength infrared (SWIR) camera, indicated generally at 200, which includes the image enhancement functionality of the present invention. The present invention can be implemented in any suitable imaging device and image processing electronics. The camera 200 includes an Indium Gallium Arsenide (InGaAs) focal plane array 212 which receives SWIR light 210 from a scene to be imaged, and FPA control 242. A conditioning module 214 receives raw analog video (image) from the focal plane array 212, and implements a number of adjustments to the raw analog video signal, such as inversion, gain adjustment, and direct current (DC) shifting. The conditioned analog video signal is then processed by an analog-to-digital (ADC) converter 216, to produce a raw digital video signal that is sent to a digital data buffer 218. The raw signal is then processed by one or more image processing modules 220, 222, 224, 226, 228, and 230, each of which can be selectively adjusted and/or switched in or out by a user. Module 220 adjusts the pixel offset value, and can be selectively turned on or off by a user. Module 222 adjusts the pixel gain value, and can also be turned on or off. Modules 224 and 230 allow for the replacement of bad pixels in the image, which feature can be selectively activated by the user. Module 226 allows a global offset value to be applied to pixels of the image, which value can be set by a user. Module 228 allows a fixed gain to be applied to the image, which gain value can be specified by the user.

Enhancement control module 234 and contrast enhancement module 236 include the processing logic described herein for implementing variable plateau histogram processing of the image. The enhanced image is sent to a test pattern and stamp insert module 238, in addition to a frame statistics averager module 250. The frame statistics averager module 250 receives information from the statistics control module 248, which allows a user to specify frame or frames to which automatic gain control (AGC) should be applied. The AGC mode select module 254 and the AGC module 252 include the processing logic described herein for implementing enhanced AGC functionality.

The test pattern/stamp insert module 238 receives a test mode signal from the test mode control module 240, which allows a user to specify whether to insert a test pattern into the video stream. In optional video lookup module 244, a lookup table 246 could be utilized to construct the output image of the camera 200 by transforming the input image using the lookup table, for performing optional image correction functions such as gamma correction, etc. The output image is then stored in a video dual-port memory 262, and is subsequently sent to a digital-to-analog (DAC) converter 264 for conversion back to an analog video signal. The analog video signal could be adjusted using a composite synchronization adjustment 266, whereupon the adjusted signal is then available for use.

The camera 200 includes a digital data source selector 256 for allowing a user to select a desired digital signal which corresponds to a desired position along the video processing chain shown in FIG. 9. For example, the user can select between raw digital video (“RAW” in FIG. 9) output, corrected digital video (“CORR” in FIG. 9) output, enhanced digital output (“ENH” in FIG. 9), test pattern video (“PAT” in FIG. 9) output, and look-up table (“LUT” in FIG. 9) output. The desired digital output is sent to a low-voltage differential signaling (LVDS) CHANNEL LINK serializer 260, whereupon the digital signal is available for use. The serializer 260 could comprise a suitable serializer manufactured by National Semiconductor, Inc., which is compatible with the CAMERA LINK standard issued by the Automated Imaging Association (AIA).

The image enhancement method of the present invention (and, in particular, the variable histogram plateau feature) can be automatically adjusted in response to various camera designs and changing environmental conditions. For example, as brightness levels decrease in a scene that is the subject of monitoring over time, the present invention could automatically generate a plurality of histogram plateaus (each of any desired shape or size) that are customized to compensate for changing light levels. Thus, for example, when dim conditions are detected, conventional histogram or plateau equalization processing could be implemented, wherein the post-processing (e.g., x^(p) and ramp non-linear processes) of the present invention are disabled and a straight plateau is defined and implemented. Further, one or more user-defined plateaus, and/or post-processing settings could be programmed and implemented as desired.

If the present invention is implemented in a standalone system capable of interfacing with a plurality of imaging systems, such a system could be programmed with a plurality of plateaus, an optimal one of which can be automatically selected for a particular camera type or manufacture. Moreover, the present invention could be adapted to operate with one or more sensors which monitor optical conditions within the camera itself, such that the enhancement method is dynamically adapted to conform to such conditions.

Having thus described the invention in detail, it is to be understood that the foregoing description is not intended to limit the spirit and scope thereof. What is desired to be protected by Letters Patent is set forth in the appended claims. 

1. A method for enhancing an image, comprising the steps of: constructing an input histogram corresponding to the image, the input histogram representing a pixel intensity distribution corresponding to the image; calculating a midpoint based upon an offset and a threshold value of the input histogram; establishing first and second horizontal plateaus to be applied to the input histogram, the first horizontal plateau extending to the midpoint and the second horizontal plateau extending from the midpoint; clipping the input histogram at the first and second horizontal plateaus to produce a clipped input histogram; constructing a cumulative histogram from the clipped input histogram; normalizing the cumulative histogram to produce a normalized cumulative histogram; and transforming the input image using the normalized cumulative histogram to produce an enhanced output image corresponding to the input image, wherein at least a portion of the input image is enhanced in the output image.
 2. The method of claim 1, further comprising excluding saturated pixels in the image from the input histogram.
 3. The method of claim 2, further comprising excluding low level pixels in the image from the input histogram.
 4. The method of claim 1, further comprising performing non-linear operations on the normalized cumulative histogram prior to transforming the input image.
 5. The method of claim 1, further comprising interpolating between bins to produce the enhanced output image.
 6. The method of claim 1, further comprising selectively adjusting gain in the output image.
 7. The method of claim 1, wherein the step of establishing the first and second horizontal plateaus further comprises establishing a dark plateau for enhancing dark regions in the image and a light plateau for enhancing light regions in the image.
 8. The method of claim 1, further comprising identifying a start bin of the input histogram when cumulative pixels are at least a first percentage of a total number of pixels collected.
 9. The method of claim 8, further comprising identifying an end bin of the input histogram when cumulative pixels are at least a second percentage.
 10. An apparatus for enhancing an image, comprising: an imaging device for capturing an image; a contrast enhancement module for receiving and processing the image, wherein the contrast enhancement module constructs an input histogram corresponding to the image, calculates a midpoint based on an offset and a threshold value of the input histogram, constructs first and second horizontal plateaus for clipping the input histogram, the first horizontal plateau extending to the midpoint and the second horizontal plateau extending from the midpoint, and clips the input histogram along the first and second horizontal plateaus and generates a normalized cumulative histogram; and means for generating an output image based upon the normalized cumulative histogram.
 11. The apparatus of claim 10, wherein the first horizontal plateau enhances dark areas of the input image and the second horizontal plateau enhances bright areas of the input image.
 12. The apparatus of claim 10, further comprising an automatic gain control module for adjusting gain of the input image.
 13. The apparatus of claim 12, wherein the automatic gain control modules includes user-selectable gain control modes for providing additional enhancement of the input image.
 14. The apparatus of claim 10, wherein the contrast enhancement module excludes saturated pixels in the image from the input histogram.
 15. The apparatus of claim 10, wherein the contrast enhancement module excludes low level pixels in the image from the input histogram.
 16. The apparatus of claim 10, wherein the contrast enhancement module performs non-linear operations on the normalized cumulative histogram.
 17. The apparatus of claim 10, further comprising means for interpolating between bins to produce the enhanced output image.
 18. The method of claim 10, wherein the contrast enhancement module identifies a start bin of the input histogram when cumulative pixels are at least a first percentage of a total number of pixels collected.
 19. The method of claim 18, wherein the contrast enhancement module identifies an end bin of the input histogram when cumulative pixels are at least a second percentage. 